<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
<input type="text" id="in" />
<button id="btn">得到菲波那切数列值</button>
<script>
document.getElementById("btn").onclick = function(){
	var num = document.getElementById("in").value
	alert(num)
	// 创建一个worker对象
	var worker = new Worker('worker.js')
	
	// 绑定接收消息的监听
	worker.onmessage = function(event){
		alert("来自子线程的消息:"+event.data)
		console.log("主线程监听的 event:"+event)
	}
	
	// 向分线程发送消息
	worker.postMessage(num)
}
</script>


	</body>
</html>
